//#include<bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;
int su[10000005], cnt = 0;
bool vis[10000005];

void o_init(int n) {
	for (long long i = 2;i <= n;i++) {
		if (vis[i] == false)
			su[++cnt] = i;
		for (int j = 1;j <= cnt && su[j] * i <= n;j++) {
			vis[j] = true;
			if (i % su[j] == 0)
				break;
		}
	}
	return;
}

int main()
{
	int n;
	cin >> n;
	o_init(n);
	for (int i = cnt-1;i >= 1;i--) {
		for (int j = 1;j <= cnt;j++) {
			if (j == i)
				continue;
			if (su[i] * su[i] * su[j] == n)
			{
				cout << su[j] << endl;
				return 0;
			}
		}
	}
	cout << n << endl;

	return 0;
}